package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class TestFileCopy {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("d:/dog.jpg");
        FileOutputStream fileOutputStream = new FileOutputStream("d:/dog2.jpg");
        byte[] bytes = new byte[1024];
        int tmp;
        while((tmp = fileInputStream.read(bytes)) != -1){
            fileOutputStream.write(bytes, 0, tmp);
        }
        System.out.println("复制完成");
        fileOutputStream.close();
        fileInputStream.close();
    }
}
